import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';
import nodeRefs from '../pageIns';
export default function AgreeTextViewAction() {
    const {orgVal, agreementPage, agreeData, agreeArea} = this.state;
    console.log(agreeArea)
    let pk_agreement = '';
    if (agreementPage === 'main') {
        const clickRow = this.props.table.getClickRowIndex('agreementList');
        pk_agreement = clickRow.record.values? clickRow.record.values.pk_agreement.value
        :clickRow.record.pk_agreement.value;
    } else {
        pk_agreement = agreeData.rows[0].values.pk_agreement.value;
    }
    const postData = {
        pk_org: orgVal.refpk,
        pk_agreement
    };

    proFetch({
        url: '/nccloud/hrcm/templet/AgreementTextViewAction.do',
        body: postData,
    })
        .then((res) => {
            if (res.success) {
                if (!res['data']) return;
                if (agreementPage === 'main') {
                    const clickRow = this.props.table.getClickRowIndex('agreementList');
                    nodeRefs.wpsview.openView([{data: clickRow.record}], 'ag')
                } else {
                      /*获取表单所有数据*/
                      let formData = this.props.form.getAllFormValue(agreeArea).rows;
                      nodeRefs.wpsview.openView(formData, 'ag')
                }
                // let location = window.location;
                // location.port ? window.open("uclient://start/http://" + location.hostname + ":" + location.port + res.data) : window.open("uclient://start/http://" + location.hostname + res.data)
            }
        });
}